package com.wjxy.java;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Scanner;

public class WordDemo {
	
	public static void main(String[] args) throws Exception {
		
		int count = 0;
		
		//File 类
		String fullPath = "C:\\work-2020\\hadoopdemo\\data\\wordall6.xls";  //全路径
		File file = new File(fullPath);
		
//		System.out.println(file.exists());
//		System.out.println(file.isFile());
//		System.out.println(file.length());
		
		// 控制台输入  System.in 系统的标准输入：键盘
//		Scanner scanner = new Scanner(System.in);
//		
//		//执行到这里，等待用户输入一行字符串
//		String next = scanner.next();
		
		//文件读: 对文件的对象
		BufferedReader br = new BufferedReader(new FileReader(file));
		//读一行数据
		String line = br.readLine();
//		System.out.println(line);
		//遍历读整个文件，一行一行读
		Scanner scanner = new Scanner(System.in);
		while(line !=null) {
			System.out.println(++count);
			System.out.println(line);
			String[] words = line.split("\t");
			//words 数组就是 英文、音标、中文
			String english = words[0];
			
			String next = scanner.next();
			
			if(next.equals(english)) {
				System.out.println("passed...");
			}else {
				System.out.println("wrong...");
			}
			
			Thread.sleep(2*1000);
			line = br.readLine();
		}
		
		
		br.close();
		
		
		
	}

}
